package com.mzkj.wanjulaile.mobile.api.modules.account.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.mzkj.common.utils.DateUtils;
import com.mzkj.common.utils.StringUtils;
import com.mzkj.wanjulaile.mobile.api.common.entity.DataEntity;
import com.mzkj.wanjulaile.mobile.api.modules.account.constant.Constant;
import com.mzkj.wanjulaile.mobile.api.modules.address.entity.Address;
import com.mzkj.wanjulaile.mobile.api.modules.coupon.entity.AccountCoupon;
import org.hibernate.validator.constraints.Length;

import java.util.Date;
import java.util.List;

/**
 * 账号实体类
 * Created by wangxw on 2016/12/12.
 */
public class Account extends DataEntity<Account> {
    private static final long serialVersionUID = 1L;
    private String nickName;        // 会员昵称
    @JSONField(serialize = false)
    private String password;        // 登陆密码
    private String phone;           // 电话
    @JSONField(serialize = false)
    private String loginFlag;       // 登陆标记：1正常， -1禁止登陆
    private Integer vipType;        // 会员属性
    private String vipStart;        // vip起始时间
    private String vipEnd;          // vip截止时间
    @JSONField(serialize = false)
    private String appOpenid;          //微信开放平台openid
    private BuyVip curBuyVip;          //当前使用的购买记录
    private String headImgUrl;      //头像
    private String unionId;    //微信unionID
    private String accountNick;  // 用户自定义昵称
    private String accountImg; //用户自定义头像
    private Date registerDate;    //会员注册手机号时间
    private VipScheme vipScheme;    //当前账号使用的vip制度
    private Integer totalShareCoupon;   //分享获得优惠券累计金额
    private Integer totalShareTime; //分享获得vip时长累计天数
    //显示用
    private Integer cartCount;
    private Integer toyFeeCount; //账户租赁玩具金额
    // vip时效范围
    private String vipSpan;

    private VipCategory vipCategory;

    //查找条件
    private Date beginDate;
    private Date endDate;


    /** 购物车数量 ,用于接收数据*/
    private Integer shoppingCartCount;
    /**  优惠券列表 ,用于接收数据*/
    private List<AccountCoupon> accountCouponList;
    private Boolean hasBuy;//是否存在购买记录

    /**
     * 账号下的地址
     */
    private List<Address> addresses;
    /**
     * 账号下对应的宝宝信息
     */
    private List<Baby> babies;

    /**
     * 账户下面总的押金
     */
    private Integer totalDeposit;

    public Account() {
        super();
    }

    public Account(String id) {
        super(id);
    }

    /**
     * vip文本显示
     */
    private String vipTypeText;

    public String getVipTypeText() {
        String vipTypeText = "";
        if (vipType != null && vipType != 0){
            if (Constant.TEMP_STAR_VIP.equals(vipType)){
                vipTypeText = "体验会员";
            }else if(Constant.ONE_STAR_VIP.equals(vipType)){
                vipTypeText = "一星会员";
            }else if(Constant.TWO_STAR_VIP.equals(vipType)){
                vipTypeText = "二星会员";
            }else{
                vipTypeText = "成为会员";
            }
        }else{
            vipTypeText = "成为会员";
        }
        return vipTypeText;
    }

    @Length(min = 0, max = 255, message = "会员昵称长度必须介于 0 和 255 之间")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Length(min = 0, max = 255, message = "登陆密码长度必须介于 0 和 255 之间")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Length(min = 0, max = 255, message = "电话长度必须介于 0 和 255 之间")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Length(min = 1, max = 50, message = "登陆标记：1正常， -1禁止登陆长度必须介于 1 和 50 之间")
    public String getLoginFlag() {
        return loginFlag;
    }

    public void setLoginFlag(String loginFlag) {
        this.loginFlag = loginFlag;
    }

    public Integer getVipType() {
        return vipType;
    }

    public void setVipType(Integer vipType) {
        this.vipType = vipType;
    }

    public String getVipStart() {
        return vipStart;
    }

    public void setVipStart(String vipStart) {
        this.vipStart = vipStart;
    }

    public String getVipEnd() {
        return vipEnd;
    }

    public void setVipEnd(String vipEnd) {
        this.vipEnd = vipEnd;
    }

    public List<Address> getAddresses() {
        return addresses;
    }

    public void setAddresses(List<Address> addresses) {
        this.addresses = addresses;
    }

    public List<Baby> getBabies() {
        return babies;
    }

    public void setBabies(List<Baby> babies) {
        this.babies = babies;
    }

    public String getAppOpenid() {
        return appOpenid;
    }

    public void setAppOpenid(String appOpenid) {
        this.appOpenid = appOpenid;
    }

    public BuyVip getCurBuyVip() {
        return curBuyVip;
    }

    public void setCurBuyVip(BuyVip buyVip) {
        this.curBuyVip = buyVip;
    }

    public String getHeadImgUrl() {
        return headImgUrl;
    }

    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }

    public Integer getCartCount() {
        return cartCount;
    }

    public void setCartCount(Integer cartCount) {
        this.cartCount = cartCount;
    }

    public Date getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Integer getTotalDeposit() {
        return totalDeposit;
    }

    public void setTotalDeposit(Integer totalDeposit) {
        this.totalDeposit = totalDeposit;
    }

    public Integer getShoppingCartCount() {
        return shoppingCartCount;
    }

    public void setShoppingCartCount(Integer shoppingCartCount) {
        this.shoppingCartCount = shoppingCartCount;
    }

    public List<AccountCoupon> getAccountCouponList() {
        return accountCouponList;
    }

    public void setAccountCouponList(List<AccountCoupon> accountCouponList) {
        this.accountCouponList = accountCouponList;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public String getAccountNick() {
        return accountNick;
    }

    public void setAccountNick(String accountNick) {
        this.accountNick = accountNick;
    }

    public String getAccountImg() {
        return accountImg;
    }

    public void setAccountImg(String accountImg) {
        this.accountImg = accountImg;
    }

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public VipScheme getVipScheme() {
        return vipScheme;
    }

    public void setVipScheme(VipScheme vipScheme) {
        this.vipScheme = vipScheme;
    }

    public Boolean getHasBuy() {
        return hasBuy;
    }

    public void setHasBuy(Boolean hasBuy) {
        this.hasBuy = hasBuy;
    }

    public Integer getToyFeeCount() {
        return toyFeeCount;
    }

    public void setToyFeeCount(Integer toyFeeCount) {
        this.toyFeeCount = toyFeeCount;
    }

    public Integer getTotalShareCoupon() {
        return totalShareCoupon;
    }

    public void setTotalShareCoupon(Integer totalShareCoupon) {
        this.totalShareCoupon = totalShareCoupon;
    }

    public Integer getTotalShareTime() {
        return totalShareTime;
    }

    public void setTotalShareTime(Integer totalShareTime) {
        this.totalShareTime = totalShareTime;
    }

    public String getVipSpan() {
        return vipSpan;
    }

    public void setVipSpan(String vipSpan) {
        this.vipSpan = vipSpan;
    }

    public VipCategory getVipCategory() {
        return vipCategory;
    }

    public void setVipCategory(VipCategory vipCategory) {
        this.vipCategory = vipCategory;
    }
}
